<?php

define('TEST_HOST', 'ami.musdb.net');
define('DEBUG', $_SERVER['HTTP_HOST'] == TEST_HOST);

//$debug = false;

define('MAIL_FROM', 'robot@musdb.net');

define('INDEX', true);
define('USE_STATS', true);

define('RECORDS_PER_PAGE', 50);

define('MAX_ARTIST_CHARS', 26);
define('MAX_RELEASE_CHARS', 26);
define('MAX_TAG_CHARS', 18);

define('MUSDB_MAX_IMAGE_SIZE', 500 * 1024); // 500KB
define('MAX_ARTIST_NAME_LENGTH', 128);
define('MAX_ARTIST_URL_LENGTH', 128);
define('MAX_ARTIST_COUNTRY_LENGTH', 64);

define('MAX_LABEL_NAME_LENGTH', 128);
define('MAX_MEMBER_NAME_LENGTH', 128);
define('MAX_TAG_NAME_LENGTH', 64);
define('MAX_RELEASE_NAME_LENGTH', 128);
define('MAX_RELEASE_SCHEDULE_DATE_LENGTH', 32);

define('MAX_USER_NAME_LENGTH', 32);
define('MIN_USER_NAME_LENGTH', 3);
define('MAX_USER_PW_LENGTH', 32);
define('MIN_USER_PW_LENGTH', 5);
define('MAX_USER_EMAIL_LENGTH', 128);
define('MAX_USER_BAN_REASON_LENGTH', 128);

define('ARTISTS_THUMB_DIR', 'data/artists/');
define('ARTISTS_THUMB_WIDTH', 200);
define('ARTISTS_THUMB_HEIGHT', 200);
define('RELEASES_THUMB_DIR', 'data/releases/');
define('RELEASES_THUMB_WIDTH', 200);
define('RELEASES_THUMB_HEIGHT', 200);
define('USERPICS_THUMB_DIR', 'data/userpics/');
define('USERPICS_THUMB_WIDTH', 70);
define('USERPICS_THUMB_HEIGHT', 120);

define('MAX_COMMENT_LENGTH', 1024);

define('SESSION_NAME', 'MUSDB');
define('ANONYMOUS_USER_NAME', _('Anonymous'));

$VALID_IMG_TYPES = array(IMAGETYPE_JPEG, IMAGETYPE_PNG);
$VALID_IMG_TYPES_STR = 'JPEG, PNG';

define('PASSWORD_KEY', 'TOSAKALOVESARCHER');

define('COOKIE_LIFETIME', 3600 * 24 * 7); // one week

define('DOMAIN', 'musdb');

define('NG', 'v2/');

//error_reporting(E_ALL);

include './inc/misc.inc.php';

// Load exceptions
require_once NG.'init/exceptions.init.php';

// Load stuff
require_once NG.'init/misc.init.php';

require_once 'PEAR.php';
require_once 'DB.php';

require_once 'Smarty/setup.php';

require_once NG.'classes/image.class.php';

require_once NG.'classes/iDBO.php';
require_once NG.'classes/iSingletone.php';

require_once NG.'classes/Singletone.php';
require_once NG.'classes/Picture.php';
require_once NG.'classes/DBObject.php';

require_once NG.'classes/DBField.php';
require_once NG.'classes/DBBoolean.php';
require_once NG.'classes/Artist.php';

require_once NG.'classes/DBO.php';

require_once NG.'classes/DBString.php';
require_once NG.'classes/DBDate.php';
require_once NG.'classes/DBUrl.php';
require_once NG.'classes/DBComment.php';
require_once NG.'classes/DBInteger.php';
require_once NG.'classes/DBYear.php';
require_once NG.'classes/DBRecordTypeId.php';
require_once NG.'classes/DBLength.php';
require_once NG.'classes/DBTrackCount.php';
require_once NG.'classes/Label.php';
require_once NG.'classes/Member.php';
require_once NG.'classes/Release.php';
require_once NG.'classes/Tag.php';

require_once NG.'classes/Stats.php';
require_once NG.'classes/ReleaseList.php';
require_once NG.'classes/LabelList.php';
require_once NG.'classes/RecordTypeList.php';

require_once NG.'classes/User.php';
require_once NG.'classes/Auth.php';
require_once NG.'classes/Search.php';
require_once NG.'classes/Todo.php';
require_once NG.'classes/Lastfm.php';
require_once NG.'classes/Mailer.php';

$smarty = new mySmarty();

$smarty->register_function('wrapArtistLink', 'wrapArtistLink');
$smarty->register_function('wrapReleaseLink', 'wrapReleaseLink');

$smarty->register_function('wrapArtistName', 'wrapArtistName');
$smarty->register_function('wrapReleaseName', 'wrapReleaseName');
$smarty->register_function('wrapTagName', 'wrapTagName');
$smarty->register_function('extract_year_from_string', 'extract_year_from_string');
$smarty->register_function('get_album_length', 'get_album_length');
$smarty->register_function('firstGenre', 'firstGenre');
$smarty->register_function('filterGenre', 'filterGenre');

include './inc/main.inc.php';